////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) Microsoft Corporation.  All rights reserved.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#include <tinyhal.h>

//--//
// some curve fits of this battery discharge vs. voltage/temp

// X is range as (MilliVolts - 3100) / 10, and below 3100, 0% state of charge
// the upper limit is then X=110  (4200 mV)
// this allows the coefficients to fit into the poly evaluator

const STATE_OF_CHARGE_SINGLE_CURVE_FIT g_MR11_2367_DATA[] =
{
    // from
    // temp code 8, -20C
    // 0.000000000000197918x6 - 0.000000000160633246x5 + 0.000000045461256891x4 - 0.000005618922975681x3 + 0.000329907178887368x2 - 0.006404656143672580x + 0.028944540582415400
    {
        0,
        7,
        56,
        3100,
        105,
        10,
        {
            4474366231552250LL,
            -1367214114196400LL,
            116916951197685LL,
            -3695863427136LL,
                56362786005LL,
                -381895507LL,
                    912734LL,
                            0LL,
                            0LL,
                            0LL,
        }
    },
    {
        10,
        7,
        56,
        3100,
        105,
        10,
        {
            4474366231552250LL,
            -1367214114196400LL,
            116916951197685LL,
            -3695863427136LL,
                56362786005LL,
                -381895507LL,
                    912734LL,
                            0LL,
                            0LL,
                            0LL,
        }
    },
    {
        20,
        7,
        56,
        3100,
        105,
        10,
        {
            4474366231552250LL,
            -1367214114196400LL,
            116916951197685LL,
            -3695863427136LL,
                56362786005LL,
                -381895507LL,
                    912734LL,
                            0LL,
                            0LL,
                            0LL,
        }
    },
    {
        30,
        7,
        56,
        3100,
        105,
        10,
        {
            4474366231552250LL,
            -1367214114196400LL,
            116916951197685LL,
            -3695863427136LL,
                56362786005LL,
                -381895507LL,
                    912734LL,
                            0LL,
                            0LL,
                            0LL,
        }
    },
    {
        40,
        7,
        56,
        3100,
        105,
        10,
        {
            4474366231552250LL,
            -1367214114196400LL,
            116916951197685LL,
            -3695863427136LL,
                56362786005LL,
                -381895507LL,
                    912734LL,
                            0LL,
                            0LL,
                            0LL,
        }
    },
    {
        50,
        7,
        56,
        3100,
        105,
        10,
        {
            4474366231552250LL,
            -1367214114196400LL,
            116916951197685LL,
            -3695863427136LL,
                56362786005LL,
                -381895507LL,
                    912734LL,
                            0LL,
                            0LL,
                            0LL,
        }
    },
};

STATE_OF_CHARGE_CURVE_FIT g_BATTERY_MEASUREMENT_CurveFit =
{
    { TRUE }, // HAL_DRIVER_CONFIG_HEADER Header;

    //--//

    ARRAYSIZE(g_MR11_2367_DATA),
    g_MR11_2367_DATA,
};


